﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using System.Web;

namespace MedicinaMuncii.IoC
{
    public class HttpRequestLifetimeManager : LifetimeManager
    {
        private string key = Guid.NewGuid().ToString();

        public override object GetValue()
        {
            return HttpContext.Current.Items[key];
        }

        public override void SetValue(object value)
        {
            HttpContext.Current.Items[key] = value;
        }

        public override void RemoveValue()
        {
            HttpContext.Current.Items.Remove(key);
        }
    } 
}
